{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340
{\fonttbl\f0\fswiss\fcharset0 ArialMT;\f1\fmodern\fcharset0 Courier;\f2\fnil\fcharset0 LucidaGrande;
}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww17560\viewh12320\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803

\f0\b\fs30 \cf0 Installing from Source on Mac OS X\

\b0\fs24 \
If you have Xcode on your Mac, you can also build and install Node.js from the source code.\
\

\b\fs26 0. Getting the Command-Line Compiler via Xcode\
\

\b0\fs24 To build Node.js from source on your OS X\'96based computer, you first need to make sure that you have the command-line compiler tools installed. To do this, you can type\
\

\f1 c++
\f0 \
\
in a terminal window. If you don\'92t know what a terminal window is, you should probably use the PKG installer method described previously for installing Node.js onto your Mac.\
\
If you see something like\
\

\f1 client:LearningNode marcw$ c++\
clang: error: no input files
\f0 \
\
you have the compiler installed and will be able to build. If instead you see\
\

\f1 client:LearningNode marcw$ c++\
-bash: c++: No such file or directory
\f0 \
\
you need to do the following:\
\
1. Launch Xcode.\
2. View Xcode Preferences (
\f2 \uc0\u8984  + ,
\f0 ).\
3. Select the Downloads page and Components group, and then click on Install or Update next to Command Line Tools.\
\
After these command-line tools are installed, the c++ command should work, and you should be able to continue compiling.\
\

\b\fs26 1. Building Node.js\

\b0\fs24 \
Start by creating some scratch space to download and compile from:\
\

\f1 cd\
mkdir -p src/scratch\
cd src/scratch\

\f0 \
The next step is to download and unpack the Node sources. You can do this using 
\f1 curl
\f0  or 
\f1 wget
\f0 :\
\

\f1 curl http://nodejs.org/dist/v0.10.1/node-v0.10.1.tar.gz -o node-v0.10.1.tar.gz\
tar xfz node-v0.10.1.tar.gz\
cd node-v0.10.1
\f0 \
\
Next, run the configuration scripts to prepare for the build:\
\

\f1 ./configure
\f0 \
\
You can let it use the default
\i  /usr/local
\i0  as the installation point because it\'92s a good location from which to run this software. If you want to install it somewhere else, you can specify the 
\f1 --prefix
\f0  switch to the configure script, as follows:\
\

\f1 ./configure --prefix =/opt/nodejs
\f0 \
\
The configure script should print out some JavaScript Object Notation (JSON) similar to the following:\
\

\f1 \{ 'target_defaults': \{ 'cflags': [],\
                       'default_configuration': 'Release',\
                       'defines': [],\
                       'include_dirs': [],\
                       'libraries': []\},\
  'variables': \{ 'clang': 1,\
                 'host_arch': 'x64',\
                 'node_install_npm': 'true',\
                 'node_install_waf': 'true',\
                 'node_prefix': '',\
                 'node_shared_openssl': 'false',\
                 'node_shared_v8': 'false',\
                 'node_shared_zlib': 'false',\
                 'node_unsafe_optimizations': 0,\
                 'node_use_dtrace': 'false',\
                 'node_use_etw': 'false',\
                 'node_use_openssl': 'true',\
                 'target_arch': 'x64',\
                 'v8_no_strict_aliasing': 1,\
                 'v8_use_snapshot': 'true'\}\}\
creating  ./config.gypi\
creating  ./config.mk\

\f0 \
Now you can build the product. Type in the following command and go get yourself a coffee (or two, depending on how fast your machine is):\
\

\f1 make
\f0 \
\
After the make has completed successfully (if it fails, do a Google search on the problem because you will almost certainly not be the first to see it), you can then install the software to your chosen prefix (/usr/local if you did not choose one):\
\

\f1 sudo make install
\f0 \
\
When you are done, you should be able to just enter\
\

\f1 node --version\
npm --version\

\f0 \
and get output somewhat similar to\
\

\f1 client:node-v0.10.3 marcw$ node --version\
v0.10.3\
client:node-v0.10.3 marcw$ npm --version\
1.1.65
\f0 \
\
}